//****************************************************************
//* Copyright (c) 2008 Ford Motor Company. All Rights Reserved.
//*
//* $$Workfile:   DateDecorator.java  $$
//* $$Revision:   1.1  $$
//* $$Author:   JLOPE262  $$
//* $$Date:   Nov 21 2008 14:26:56  $$
//*
//*****************************************************************
package ar.com.ford.it.fullEconomics.view.displaytag;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.jsp.PageContext;
import org.displaytag.decorator.DisplaytagColumnDecorator;
import org.displaytag.exception.DecoratorException;
import org.displaytag.properties.MediaTypeEnum;

public class DateDecorator implements DisplaytagColumnDecorator {

	private static final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
	
	public Object decorate(Object columnValue, PageContext pageContext, MediaTypeEnum media) throws DecoratorException {
        if(columnValue!=null){
            return dateFormat.format((Date)columnValue);
        }else{
            return null;
        }
		
	}

}
